package xin.marcher.module.construction.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import xin.marcher.module.common.core.PageResult;
import xin.marcher.module.construction.domain.dto.*;
import xin.marcher.module.construction.domain.entity.*;
import xin.marcher.module.construction.domain.request.ProducingAreaRequest;

import java.util.List;

/**
 * 商品相关对象克隆
 *
 *
 */
@Mapper(componentModel = "spring")
public interface ProductConverter {
    /**
     * 对象克隆
     *
     * @param producingAreaRequest
     * @return
     */
    @Mappings({
            @Mapping(target = "updateUser", source = "operateUser")
    })
    ProducingAreaDO converterDO(ProducingAreaRequest producingAreaRequest);

    /**
     * 对象克隆
     *
     * @param skuInfoDO
     * @return
     */
    SkuPriceUpdateRecordDO converterDO(SkuInfoDO skuInfoDO);

    /**
     * 分页对象克隆
     *
     * @param producingAreaPage
     * @return
     */
    @Mappings({
            @Mapping(target = "content", source = "records"),
            @Mapping(target = "totalElements", source = "total"),
            @Mapping(target = "number", source = "current"),
            @Mapping(target = "totalPages", source = "pages"),
    })
    PageResult<ProducingAreaDTO> converterPageResult(Page<ProducingAreaDO> producingAreaPage);

    /**
     * 集合对象克隆
     *
     * @param producingAreaDOS
     * @return
     */
    List<ProducingAreaDTO> converterAreaDTOList(List<ProducingAreaDO> producingAreaDOS);

    /**
     * 集合对象克隆
     *
     * @param producingAreaDO
     * @return
     */
    ProducingAreaDTO converterAreaDTO(ProducingAreaDO producingAreaDO);

    /**
     * 集合对象克隆
     *
     * @param skuSellerRelationDOList
     * @return
     */
    List<SkuInfoDTO> converterSkuInfoList(List<SkuSellerRelationDO> skuSellerRelationDOList);

    /**
     * 集合对象克隆
     *
     * @param skuDetailList
     * @return
     */
    List<SkuDetailDTO> converterSkuDetailList(List<SkuDetailDO> skuDetailList);

    /**
     * 集合对象克隆
     *
     * @param skuDetailDO
     * @return
     */
    @Mappings({
            @Mapping(target = "skuInfoDTO", source = "skuInfoDO"),
            @Mapping(target = "itemStorageDTO", source = "itemStorageDO"),
            @Mapping(target = "itemShelfLifeDTO", source = "itemShelfLifeDO"),
            @Mapping(target = "itemVideoImgDTOS", source = "itemVideoImgDOS"),
            @Mapping(target = "itemSaleDTO", source = "itemSaleDO"),
            @Mapping(target = "itemPopularizeDTO", source = "itemPopularizeDO")
    })
    SkuDetailDTO converterSkuDetail(SkuDetailDO skuDetailDO);

    /**
     * 对象克隆
     *
     * @param skuInfoDO
     * @return
     */
    SkuInfoDTO converterDTO(SkuInfoDO skuInfoDO);

    /**
     * 对象克隆
     *
     * @param productDetailDO
     * @return
     */
    ItemInfoDO converterDO(ProductDetailDO productDetailDO);

    /**
     * 对象克隆
     *
     * @param itemDetailDO
     * @return
     */
    @Mappings({
            @Mapping(target = "itemInfoDTO", source = "itemInfoDO"),
            @Mapping(target = "itemStorageDTO", source = "itemStorageDO"),
            @Mapping(target = "itemShelfLifeDTO", source = "itemShelfLifeDO"),
            @Mapping(target = "itemVideoImgDTOS", source = "itemVideoImgDOS"),
            @Mapping(target = "itemSaleDTO", source = "itemSaleDO"),
            @Mapping(target = "itemPopularizeDTO", source = "itemPopularizeDO")
    })
    ItemDetailDTO converterItemDetailDO(ItemDetailDO itemDetailDO);

    /**
     * 对象克隆
     *
     * @param itemInfoDO
     * @return
     */
    ItemInfoDTO converterDTO(ItemInfoDO itemInfoDO);

    /**
     * 对象克隆
     *
     * @param itemStorageDO
     * @return
     */
    ItemStorageDTO converterDTO(ItemStorageDO itemStorageDO);

    /**
     * 对象克隆
     *
     * @param itemShelfLifeDO
     * @return
     */
    ItemShelfLifeDTO converterDTO(ItemShelfLifeDO itemShelfLifeDO);

    /**
     * 对象克隆
     *
     * @param itemVideoImgDOS
     * @return
     */
    List<ItemVideoImgDTO> converterDTOList(List<ItemVideoImgDO> itemVideoImgDOS);

    /**
     * 对象克隆
     *
     * @param itemVideoImgDO
     * @return
     */
    ItemVideoImgDTO converterDTO(ItemVideoImgDO itemVideoImgDO);

    /**
     * 对象克隆
     *
     * @param itemSaleDO
     * @return
     */
    ItemSaleDTO converterDTO(ItemSaleDO itemSaleDO);

    /**
     * 对象克隆
     *
     * @param itemPopularizeDO
     * @return
     */
    ItemPopularizeDTO converterDTO(ItemPopularizeDO itemPopularizeDO);

    /**
     * 集合对象克隆
     *
     * @param list
     * @return
     */
    List<ItemDetailDTO> converterItemDetailDOList(List<ItemDetailDO> list);
}
